package project.jpdftools.other;

import java.awt.event.KeyEvent;
import javax.swing.JTextField;

public class IntegerTextField extends JTextField {

    private final static String badchars = "{}[]-`~!@#$%^&*()_+=\\|\"':;?/>.<, ";

    @Override
    public void processKeyEvent(KeyEvent ev) {

        char c = ev.getKeyChar();

        if ((Character.isLetter(c) && !ev.isAltDown()) || badchars.indexOf(c) > -1) {
            ev.consume();
            return;
        }
        super.processKeyEvent(ev);
    }
}
